<?php
namespace Portal\Model;

use Common\Model\CommonModel;

class MsgModel extends CommonModel {

    const MSG_TYPE_ADD_ANSWER       = 1; // 给问题添加答案
    const MSG_TYPE_ADD_COMMENT      = 2; // 给回答添加评论


    // 添加 -- 回答问题的消息
    public static function add_answer_msg ($item_id, $content, $to_id, $url)
    {
        $data = array(
            'type'      => self::MSG_TYPE_ADD_ANSWER,
            'item_id'   => $item_id,
            'content'   => $content,
            'to_uid'    => $to_id,
            'url'       => $url,
            'time'      => time(),
        );
        $self = new self();
        $self->add($data);
    }

    // 添加 -- 回复答案的消息
    public static function add_comment_msg ($item_id, $content, $to_id, $url)
    {
        $data = array(
            'type'      => self::MSG_TYPE_ADD_COMMENT,
            'item_id'   => $item_id,
            'content'   => $content,
            'to_uid'    => $to_id,
            'url'       => $url,
            'time'      => time(),
        );
        $self = new self();
        $self->add($data);
    }


}